package cn.designmode.adapter;

import java.util.HashMap;
import java.util.Map;

public class AdapteeHandler implements Handler<Adaptee> {

    private static volatile Map<Class<?>, Adaptee> adapteeMap = new HashMap<Class<?>, Adaptee>() {{
        put(Book.class, new BookAdaptee());
        put(Movie.class, new MovieAdaptee());
    }};

    @Override
    public Adaptee handle(Object o) {
        return adapteeMap.get(o.getClass());
    }

}
